﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Koeltp.DataAccess;

public partial class Client_Article_article : System.Web.UI.Page
{
    DataBind db = new DataBind();
    int articleId;
    protected void Page_Load(object sender, EventArgs e)
    {
        articleId = Convert.ToInt32(Request.QueryString["article_id"]); 
        if (!Page.IsPostBack)
        {
            db.UpdateReaderNumber(articleId);
            db.GetBindArticle(this.rpt_ArticlDetailed, articleId);
            db.NavGetBind(this.rpt_Nav, articleId);
            db.TopArticleGetBind(this.rpt_Top);
            db.LinksGetBind(this.rpt_Links);
            db.CommentGetBind(this.rpt_CommentList, articleId);
            //某一篇文章的评论总数
            lb_commentCount.InnerText = Request.QueryString["comment_count"].ToString();
            
        }
    }
    protected void btn_Submit_Click(object sender, EventArgs e)
    {
        Int32 Users_Id = 0;
        if (Session["Users_Id"] != null)
        {
            Users_Id = Convert.ToInt32(Session["Users_Id"]);
        }
        String Comment_Name = author.Value;
        String Comment_eMail = email.Value;
        String Comment_Url = url.Value;
        String Comment_Content = comment.Value;
        Int32 status= db.InsertComment(articleId,Comment_Name,Comment_eMail,Comment_Url,Comment_Content,Users_Id);
        db.CommentGetBind(this.rpt_CommentList, articleId);
    }
    /// <summary>
    /// 返回评论总数
    /// </summary>
    /// <returns></returns>
    public Int32 CommentCount()
    {
        return db.CommentCount();
    }
    /// <summary>
    /// 文章总数
    /// </summary>
    /// <returns></returns>
    public Int32 GetArticleCount()
    {
        return db.ArticleCount();
    }
    //当前在线人数
    public string GetOnline()
    {
        return Application["online"].ToString();
    }
}